home *** CD-ROM | disk | FTP | other *** search
/ ETO Development Tools 1 / ETO Development Tools 1.iso / Essentials / Developer Essentials Jul 90 / Technical Docs / Apple II Technical Notes / Technical Notes (Text) / ATLK / TN.ATLK.004 < prev    next >
Encoding:
Text File  |  1990-04-03  |  8.6 KB  |  186 lines  |  [TEXT/pdos]

  1. Apple II
  2. Technical Notes
  3. _____________________________________________________________________________
  4.                                                   Developer Technical Support
  5.  
  6. AppleTalk
  7. #4:    Printing Through the Firmware
  8.  
  9. Revised by:    Jim Luther                                          March 1990
  10. Written by:    Matt Deatherage & Jim Luther                         July 1989
  11.  
  12. This Technical Note discusses considerations of printing through the AppleTalk 
  13. firmware in transparent mode.
  14. Changes since September 1989:  Modified to suggest that Network Printer be 
  15. added to the printer slot choices and revised CheckATalk code sample to work 
  16. correctly with the ROM 03 Apple IIGS.
  17. _____________________________________________________________________________
  18.  
  19. The AppleShare Programmer's Guide to the Apple IIGS states that printing in 
  20. transparent mode (through Super Serial Card emulation for older applications 
  21. which don't know about AppleTalk) is initiated when you do a PR#7 command.
  22.  
  23. This statement is pretty short-sighted.  It's much like saying printing 
  24. through an ImageWriter II is initiated when you do a PR#1 command--it's only 
  25. true if what you want is where you think it is--and usually it isn't.
  26.  
  27. An Apple IIe Workstation Card, although recommended for slot 7, can work in 
  28. almost any slot (just like an ImageWriter II can be connected to nearly any 
  29. slot, except maybe slot 3 when the 80-column firmware is active).  An Apple 
  30. IIGS with ROM versions 00 or 01 may only have AppleTalk firmware located in 
  31. slot 7.  An Apple IIGS with ROM version 03 may only have AppleTalk firmware 
  32. located in either slot 1 or 2.
  33.  
  34. Before printing through the Super Serial Card emulation to AppleTalk, take the 
  35. same precautions you would take before printing to any slot--check to make sure 
  36. you see the requested slot as a Pascal device before using Pascal entry 
  37. points, and try to look for the signature bytes that indicate the features you 
  38. want are present.  In general, avoid hard-coding slot numbers for anything.
  39.  
  40. ProDOS 8 applications which offer network printing should give users the 
  41. choice of printing to any of the seven slots as well as the Network Printer.  
  42. When Network Printer is selected, the application can find the AppleTalk slot 
  43. by using the 6502 code sample included in this Note.  Allowing the selection 
  44. of Network Printer is especially important for applications that keep a 
  45. configuration file containing a user's default printer setup.  If an 
  46. application keeps only the slot number in the configuration file, users may 
  47. need to change the printer selection often if they print from several 
  48. different machines (printing to a slot with no firmware generally results in a 
  49. crash).
  50.  
  51. The code sample uses two methods to find which slot or port the network 
  52. connection should use for transparent printing.  The first method works with 
  53. the Apple IIe Workstation card and the ROM 01 Apple IIGS.  It looks at the 
  54. AppleTalk completion routine pointer, and if that pointer points to an address 
  55. in slot ROM space, then that slot contains the transparent network printing 
  56. firmware.  In other words, if the completion routine points to $0000CnXX, 
  57. where n is between 1 and 7, then n is the slot to be used for transparent 
  58. printing.  If the completion routine pointer does not point to slot ROM, then 
  59. the application cannot determine what slot to print through and must query the 
  60. user.  The second method works only with the ROM 03 Apple IIGS.  It checks two 
  61. Control Panel parameter RAM values to see if AppleTalk is using either serial 
  62. port.
  63.  
  64. Note:  This convention returns a slot number between 1 and 7, which is 
  65.        not fully compatible with the Slot Arbiter.  When using GS/OS, do 
  66.        not pass this number directly to the Slot Arbiter.  Refer to Apple 
  67.        IIGS Technical Note #69, The Ins and Outs of Slot Arbitration.
  68.  
  69. This technique applies only to ProDOS 8 programs.  Apple IIGS applications 
  70. running under GS/OS should do text printing over the network through the 
  71. Remote Print Manager (RPM) driver, which can be identified by a deviceID of 
  72. $001F as returned from DInfo.
  73.  
  74. ;
  75. ; This routine will identify AppleTalk and the slot AppleTalk is associated
  76. ; with (if possible). This routine is for ProDOS 8 applications only.
  77. ;
  78.                     keep CheckATalk
  79.                     longa off
  80.                     longi off
  81.                     mcopy 2/AInclude/M16.MiscTool
  82.  
  83. CheckATalk          start
  84.                     lda #$00
  85.                     sta ATalkSlot       default to no AppleTalk slot
  86.  
  87. ; Check for AppleTalk (see AppleTalk Technical Note #1)
  88.  
  89.                     jsr $BF00           ProDOS 8 MLI
  90.                     dc  h'42'           $42 command for network calls
  91.                     dc  a'InfoParams'   Parameter list address
  92.                     bcs NoATalk         no AppleTalk; handle the error
  93.  
  94. ; Get machine type & ROM version (see Apple II Miscellaneous Technical Note #7)
  95.  
  96.                     sec
  97.                     jsr $FE1F           What kind of machine are we on?
  98.                     bcs CheckCom        Not a IIGS, check completion address
  99.                     cpy #$03
  100.                     bcc CheckCom        Earlier than ROM 03 IIGS, check
  101. ;                                         completion address
  102.  
  103. ROM03               anop                ROM 03 or greater IIGS use
  104. ;                                         parameter RAM to find slot
  105.                     clc                 switch to native mode
  106.                     xce
  107.                     rep #$30            16 bit m and x
  108.                     longa on
  109.                     longi on
  110.  
  111.                     pea $0000           space for result
  112.                     pea $000C           port 2 type
  113.                     _ReadBParam         read parameter RAM
  114. ;                                         (2 byte result left on stack)
  115.  
  116.                     pea $0000           space for result
  117.                     pea $0000           port 1 type
  118.                     _ReadBParam         read parameter RAM
  119.                     pla                 get port 1 setting (2 bytes)
  120.  
  121.  
  122.                     sec                 emulation mode
  123.                     xce
  124.                     longa off
  125.                     longi off
  126.  
  127.                     cmp #$02            is port 1 AppleTalk?
  128.                     bne TryPort2        no
  129.                     inc ATalkSlot       yes
  130.                     pla                 remove port 2 setting LSB (1 byte)
  131.                     bra NewExit           and exit
  132.  
  133. TryPort2            pla                 get port 2 setting LSB (1 byte)
  134.                     cmp #$02            is port 2 AppleTalk?
  135.                     bne NewExit         no
  136.                     lda #$02            yes
  137.                     sta ATalkSlot
  138.  
  139. NewExit             pla                 remove port 2 setting MSB (1 byte)
  140.                     lda ATalkSlot
  141.                     beq AskForSlot
  142.                     bra HaveSlot
  143.  
  144. CheckCom            anop                use completion address to find slot
  145.                     lda ComReturn+2     bank $00?
  146.                     ora ComReturn+3     high byte = 0?
  147.                     bne AskForSlot      no, so slot can't be determined
  148.                     lda ComReturn+1     get the address page
  149.                     cmp #$C8
  150.                     bcs AskForSlot      greater or equal to $C8 is bad
  151.                     cmp #$C1
  152.                     bcc AskForSlot      less than $C1 is bad
  153.                     and #$0F            $Cn = $0n
  154.                     sta ATalkSlot
  155.  
  156. HaveSlot            anop                AppleTalk is installed and is in
  157. ;                                         slot #ATalkSlot
  158.  
  159. AskForSlot          anop                AppleTalk is installed but slot
  160. ;                                         can't be determined
  161.  
  162. NoATalk             anop                AppleTalk is not installed
  163.  
  164.                     rts                 so this sample returns
  165.  
  166. AtalkSlot           entry
  167.                     dc  h'00'           Slot to use for transparent printing
  168.  
  169. InfoParams          dc  h'00'           Synchronous only
  170.                     dc  h'02'           GetInfo call number
  171.                     ds  2               result code
  172. ComReturn           ds  4               completion return address
  173.                     ds  8               space for other result info
  174.  
  175.                     end
  176.  
  177.  
  178. Further Reference
  179. _____________________________________________________________________________
  180.   o  AppleShare Programmer's Guide for the Apple IIGS
  181.   o  Apple IIGS Technical Note #69, The Ins and Outs of Slot Arbitration
  182.   o  Apple II AppleTalk Technical Note #1, Identifying AppleTalk
  183.   o  Apple II Miscellaneous Technical Note #7, Apple II Family Identification
  184.   o  Apple II Miscellaneous Technical Note #8, Pascal 1.1 Identification Bytes
  185.  
  186.